import { useState, useEffect } from 'react'
const useMouse = () => {
  const [count, setCount] = useState({
    left: 0,
    top: 0
  })
  useEffect(() => {
    const move = (e) => {
      console.log(1);
      setCount({
        left: e.pageX,
        top: e.pageY
      })
    }
    document.addEventListener('mousemove', move)
    return () => {
      document.removeEventListener('mousemove', move)
    }
  }, [])
  return count
}

export default useMouse